<!DOCTYPE html>
<html>
    <head>
        <title>测试同步到$model</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 
        <script src="../avalon.js" ></script>
        <script>
            var model = avalon.define({
                $id: "ms-duplex-5",
                rows: {name: 'a', age: 45},
                text: "OO",
                arr: [{name: "55"}],
                log: function() {
                    if (window.JSON && JSON.stringify) {
                        var value = model.$model
                        document.getElementById("ms-duplex-show-json").value = JSON.stringify(value, 4, "\t")
                    }
                }
            });

        </script>
    </head>
    <body>
        <h3>测试同步到$model</h3>
        <fieldset ms-controller="ms-duplex-5">
            <table class="shim-table">
                <tr ms-repeat-row='rows'>
                    <td>
                        {{$key}}: {{$val}} <input ms-duplex="$val">
                    </td>
                </tr>
            </table>
            <ul>
                <li ms-repeat="arr">{{el.name}}<input ms-duplex="el.name"></li>
            </ul>
            <p>text: <input ms-duplex="text"/></p>
            <p>
                <button ms-click="log">打印出来</button>
            </p>
            <textarea id="ms-duplex-show-json" style="width:60%;height:210px;"></textarea>
        </fieldset>
    </body>
</html>